//
//  HomePageCell3.m
//  Mtime2.0
//
//  Created by 凉气的Mac on 16/9/5.
//  Copyright © 2016年 凉气的Mac. All rights reserved.
//

#import "HomePageCell3.h"

#import "MtimeButton2.h"

@interface HomePageCell3 ()

@property(nonatomic,strong)  NSArray *imageArray;

@property(nonatomic,strong)  NSArray *titleArray;

@end

@implementation HomePageCell3

-(NSArray *)imageArray{

    if (_imageArray == nil) {
        
        _imageArray = @[[UIImage imageNamed:@"homepage_mallentry_ ranking"],[UIImage imageNamed:@"homepage_mallentry_ box-office"],[UIImage imageNamed:@"homepage_mallentry_ notice"],[UIImage imageNamed:@"homepage_mallentry_ guess"]];
        
    }

    return _imageArray;
}

-(NSArray *)titleArray{

    if (_titleArray == nil) {
        
        _titleArray = @[@"时光热榜",@"全球票房",@"新片预告",@"猜电影"];
        
    }

    return _titleArray;
}


-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{

    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
        [self setupUI];
        
    }
    
    return self;
}

#pragma mark --
#pragma mark --设置界面
-(void)setupUI{

    CGFloat margin = 30;
    
    CGFloat btnWH = (kScreen.size.width - 5 * margin) / 4;
    
    for (int i = 0; i < 4; i ++) {
        
        CGFloat btnX = margin + i * (margin + btnWH);
        
        MtimeButton2 *button = [[MtimeButton2 alloc]init];
        
        [button setImage:self.imageArray[i] forState:UIControlStateNormal];
        
        [button setTitle:self.titleArray[i] forState:UIControlStateNormal];
        
        [button setTitleColor:[UIColor colorWithWhite:0.800 alpha:1.000] forState:UIControlStateNormal];
        
        [self.contentView addSubview:button];
        
        [button mas_makeConstraints:^(MASConstraintMaker *make) {
            
            make.top.equalTo(self.contentView).offset(10);
            
            make.bottom.equalTo(self.contentView).offset(-20);
            
            make.left.equalTo(self.contentView).offset(btnX);
            
            make.width.height.equalTo(@(btnWH)).priorityHigh();
            
        }];
        
    }

}


@end












































